<?php

namespace App\Observers;

use App\Models\Notice;
use Illuminate\Support\Facades\Log;
use App\Jobs\NoticeJob;
class NoticeObserver
{
    /**
     * Handle the notice "created" event.
     *
     * @param  \App\Models\Notice  $notice
     * @return void //添加完成后，执行方法
     */
    public function created(Notice $notice)
    {
        //
//        Log::info('你好================');
        //发布一个任务，生成一个任务
        dispatch(new NoticeJob());
    }

    /**
     * Handle the notice "updated" event.
     *
     * @param  \App\Models\Notice  $notice
     * @return void 修改完成后，执行方法
     */
    public function updated(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "deleted" event.
     *
     * @param  \App\Models\Notice  $notice
     * @return void
     */
    public function deleted(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "restored" event.
     *
     * @param  \App\Models\Notice  $notice
     * @return void
     */
    public function restored(Notice $notice)
    {
        //
    }

    /**
     * Handle the notice "force deleted" event.
     *
     * @param  \App\Models\Notice  $notice
     * @return void
     */
    public function forceDeleted(Notice $notice)
    {
        //
    }
}
